<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        body{
            margin:0;
            padding:0;
        }
        .component{
            width:50%;
            height:30px;
            margin-bottom: 20px;
            background-color: #eee;
            display: none;
        }
    </style>
    <script src="../js/jquery-3.3.1.min.js"></script>
    <script src="../js/jquery-ui.min.js"></script>
    <script src="../js/jquery.fullpage.min.js"></script>
    <script>
        $(function(){
            $('#h5').fullpage({
                'sectionsColor':['#254875','#00FF00','#254587','#695684'],
                onLeave:function(index,nextIndex,direction){
                    $('#h5').find('.page').eq(index-1).trigger('onLeave')
                    $(this).find('.component').trigger('onLeave')
                },
                afterLoad:function(index,nextIndex,direction){
                    // $('#h5').find('.page').eq(index-1).trigger('onLoad')
                    $(this).find('.component').trigger('onLoad')

                }
            });
            $('.component').on('onLeave',function(){
                // console.log($(this).attr('id'),'==>>','onLeave')
                $(this).fadeOut();
            })
            $('.component').on('onLoad',function(){
                $(this).fadeIn();
            })
        })

    </script>
</head>
<body>
    <div id="h5">
        <div class="page section" id="page-1">
            <div class="component log">logo</div>
            <div class="component slogan">slogan</div>
        </div>
        <div class="page section" id="page-2">
            <div class="component desc">desc</div>
        </div>
        <div class="page section" id="page-3">
            <div class="component bar">bar</div>
        </div>
    </div>
    
</body>
</html>